package ch.ti.bfh.app.loodel.service.admin;

import ch.ti.bfh.app.loodel.service.LearningEventInvitationData;
import ch.ti.bfh.app.loodel.service.MemberData;
import ch.ti.bfh.app.loodel.service.create.CreateLearningEventData;
import org.springframework.security.access.annotation.Secured;
import org.springframework.security.access.prepost.PreAuthorize;

import java.util.List;

public interface LearningEventAdminService {

    @PreAuthorize("hasRole('ROLE_ADMIN') or hasPermission(#learningEventId, 'learningEvent', 'isLearningEventOwner')")
    void updateLearningEventAndSendUpdateMailNotification(String learningEventId, LearningEventUpdateData learningEventUpdateData, String customUpdateNotificationText) throws LearningEventAdministrationException;

    @PreAuthorize("hasRole('ROLE_ADMIN') or hasPermission(#learningEventId, 'learningEvent','isLearningEventOwner')")
    void closeLearningEventVotes(String learningEventId, List<Long> acceptedTimeSlots) throws LearningEventAdministrationException;

    @PreAuthorize("hasRole('ROLE_ADMIN') or hasPermission(#learningEventId, 'learningEvent', 'isLearningEventOwner')")
    void deleteLearningEvent(String learningEventId) throws LearningEventAdministrationException;

    @PreAuthorize("hasRole('ROLE_ADMIN') or hasPermission(#learningEventId, 'learningEvent', 'isLearningEventOwner')")
    void sendFurtherInvitation(String learningEventId, LearningEventInvitationData learningEventInvitationData);

    @Secured({"ROLE_USER"})
    String getDefaultUpdateMailNotificationText(CreateLearningEventData createLearningEventData, String customText);

    @Secured({"ROLE_USER"})
    List<MemberData> findMemberDataForInvitationForExistingLearningEvent(String queryTerm, Long learningEventId);


}

